#pragma once

#include <QComboBox>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QRadioButton>
#include <QWidget>

class WifiInfoInputEdit : public QWidget
{
    Q_OBJECT
public:
    enum class EncryptionType {
        WPA,
        WPA2,
        WEP,
        OPEN,
    };

    explicit WifiInfoInputEdit(QWidget *parent = nullptr);

    QString getWifiInfoString() const;
    void clear();

private slots:
    void onWifiInfoChanged();
signals:
    void infoChanged();

private:
    using cryptoPair                  = std::pair<const char *, EncryptionType>;
    static constexpr auto cryptoPairs = std::to_array<cryptoPair>({
        {"WPA", EncryptionType::WPA},
        {"WPA2", EncryptionType::WPA2},
        {"WEP", EncryptionType::WEP},
        {"OPEN", EncryptionType::OPEN},
    });

    QLineEdit    *ssidLineEdit;
    QLineEdit    *passwordLineEdit;
    QComboBox    *cryptoComboBox;
    QRadioButton *hiddenRadio;

    QString getSSID() const;
    QString getPassword() const;
    QString getEncryptionTypeStr() const;
    QString getHiddenStr() const;
};
